<?php

/*
 * This file is part of the Geek-Zoo Projects.
 *
 * @copyright (c) 2010 Geek-Zoo Projects More info http://www.geek-zoo.com
 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License
 * @author quqiang <quqiang@geek-zoo.com>
 *
 */
require ROOT_PATH.'/Helper/front_abstract.php';

class Action extends front_abstract
{
    function index()
    {
	    //$info = _model('post')->read('order by id desc');
	    //echo '<pre>';
	    //print_r($info);
	    //echo '</pre>';
                $type = _GET('type', 0);

				$slider = _GET('slider', 0);
				
				if($slider){
					
				$gettime = get_slider_time($slider);
				
				$where = " where add_time > {$gettime} and status='0' ";
				
				}else{
					
					$where = "where status='0'";
					
				}
				if(!$type){
					
					$oderby = 'add_time desc';
				}
                switch ($type){
	
                    case 1:

                    $oderby = 'add_time desc';

                    break;

                    case 2:

                    $oderby = 'hotcolor_num asc';

                    break;

                    case 3:

                    $oderby = 'hotcolor_num desc';

                    break;
                }

                if(empty($oderby)){
	
                    $oderby = "add_time";

                    }

                $getPost = _model("post")->getList($where." ORDER BY {$oderby}", new Pager(20));

                $this->view->assign($getPost);
        
                $this->view->display('front/index.html');

        // _model('test')->get_test(array(1,6,7));
	 // $this->msg('ok','hello');
        //_model('test')->get_test();
        //$this->view->display('test.html');
        // $ids = array();
        // for ($i=0; $i < 200; $i++) { 
        //     $id = _model('post')->create(array('content'=>'POST内容测试'.'_'.$i, 'user_id'=>1, 'add_time'=>time()));
        //     $ids[] = $id;
        // }
        // 
        // foreach ($ids as $value) {
        //     for ($i=0; $i < 20; $i++) { 
        //         _model('comment')->create(array('post_id'=>$value, 'user_id'=>1, 'add_time'=>time(), 'content'=>'评论测试POSTid_'.$value));
        //     }
        // }
        

    }

}



?>
